/**
 * 
 */
package com.et114.core.utility;

import com.et114.core.common.AppContext;


/**
 * @author guanhw
 */
public class URLEncoder  {
	
	private URLEncoder () {}
	
	
	public static String encode( String str ) throws  java.io.UnsupportedEncodingException {
		String charSet = AppContext.getFrameWorkPropertiesBean ( ).getCharSet ( ) ;
		/*
		if ( AppContext.getFrameWorkPropertiesBean ( ).getAppServer ( ).equalsIgnoreCase ( FrameWorkPropertiesBean.APP_SERVER_WAS ) ) {
			str = java.net.URLEncoder.encode ( str  ) ;
		}
		else if ( AppContext.getFrameWorkPropertiesBean ( ).getAppServer ( ).equalsIgnoreCase ( FrameWorkPropertiesBean.APP_SERVER_TOMCAT ) ) { 
			str = java.net.URLEncoder.encode ( str , charSet ) ;
		}
		return str ; 
		*/
		return java.net.URLEncoder.encode ( str , charSet ) ;
	}
	
	
	public static String decode( String str )  throws  java.io.UnsupportedEncodingException { 
		String charSet = AppContext.getFrameWorkPropertiesBean ( ).getCharSet ( ) ;
		return java.net.URLDecoder.decode ( str , charSet ) ;
		/*
		if ( AppContext.getFrameWorkPropertiesBean ( ).getAppServer ( ).equalsIgnoreCase ( FrameWorkPropertiesBean.APP_SERVER_WAS ) ) {
			str = java.net.URLDecoder.decode ( str  ) ;
		}
		else if ( AppContext.getFrameWorkPropertiesBean ( ).getAppServer ( ).equalsIgnoreCase ( FrameWorkPropertiesBean.APP_SERVER_TOMCAT ) ) { 
			str = java.net.URLDecoder.decode ( str , charSet ) ;
		}		
		return str ;
		*/ 
	}
}
